package com.boot.unity.api.modules.province.dao;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.*;

import com.boot.unity.api.modules.province.entity.TrainingTime;

@Mapper
public interface TrainingTimeDao {

//    @Select("select * from province_training_time t where t.id = #{id}")
//    TrainingTime getById(Long id);
//
//    @Delete("delete from province_training_time where id = #{id}")
//    int delete(Long id);

    int update(TrainingTime trainingTime);

    int save(TrainingTime trainingTime);

    //@Select("select * from province_training_time where sfzmhm = #{sfzmhm} and pxkm = #{pxkm} and pxcx = #{pxcx} limit 1")
    TrainingTime getTrainingTime(TrainingTime trainingTime);

    @Select("select * from province_training_time order by updateTime DESC LIMIT 10")
    List<TrainingTime> list10();

//    int count(@Param("params") Map<String, Object> params);

//    List<TrainingTime> list(@Param("params") Map<String, Object> params, @Param("offset") Integer offset, @Param("limit") Integer limit);

    @Select("SELECT * from (SELECT count(*) num,sfzmhm,pxkm,pxcx from v_pay_province_training_time where origin = 1 and jszt = 0 GROUP BY sfzmhm,pxkm,pxcx) t where t.num > 1")
    List<TrainingTime> queryColumnMore();

    @Select("SELECT max(id) id from v_pay_province_training_time where pxcx = #{pxcx} and pxkm = #{pxkm} and sfzmhm = #{sfzmhm}")
    int findByspp(@Param("sfzmhm") String sfzmhm,@Param("pxkm") Integer pxkm,@Param("pxcx") String pxcx);

    @Update("update province_training_time set origin = 3 where id = #{id}")
    int updateMoreColumn(@Param("id") Integer id);


}
